package com.yupi.yuojbackendjudgeservice.judge.codesanbox;

/**
 * @Author FengHuan Wang
 * @Date 2025/3/9 9:59
 * @Version 1.0
 */


import com.yupi.yuojbackendjudgeservice.judge.codesanbox.impl.ExampleSanBox;
import com.yupi.yuojbackendjudgeservice.judge.codesanbox.impl.RemoteSanBox;
import com.yupi.yuojbackendjudgeservice.judge.codesanbox.impl.ThirdPartySanBox;

/**
 * 代码沙箱工厂，根据字符串参数创建指定的代码沙箱实例
 */
public class CodeSanBoxFactory {
    /**
     * 创建代码沙箱示例
     * @param type
     * @return
     */
    public static CodeSanBox newInstance(String type) {

        switch (type){
            case "example":
                return new ExampleSanBox();
            case "remote":
                return new RemoteSanBox();
            case "thirdParty":
                return new ThirdPartySanBox();
            default:
                return new ExampleSanBox();
        }
    }
}
